<div class="grid-content bg-purple">
    <czy-toolbar>
        <czy-toolbar-item>
            <span slot="label">名称</span>
            <span slot="item"><el-input v-model="code"></el-input></span>
        </czy-toolbar-item>
        <czy-toolbar-btn>
            <el-button-group>
                <el-button type="primary" icon="search" size="small" @click="search">查询</el-button>
                <el-button type="primary" icon="plus" size="small" @click="toAdd">新增</el-button>
            </el-button-group>
        </czy-toolbar-btn>
    </czy-toolbar>
    <el-table :data="deptData" border stripe highlight-current-row @current-change="groupChange">
        <el-table-tree-column :expand-all="false" :remote="selectSubDept" parentKey="parentId"
                              levelKey="depth" childNumKey="childNum"
                              file-icon="fa fa-file" folder-icon="fa fa-folder"
                              prop="code" label="编码">
        </el-table-tree-column>
        <el-table-column prop="name" label="名称"></el-table-column>
        <el-table-column label="操作" width="150">
            <template scope="scope">
                <el-tooltip content="新增" placement="top" effect="light" :enterable="false">
                    <el-button size="mini" type="primary" icon="plus"
                               @click="toAddChild(scope.row)"></el-button>
                </el-tooltip>
                <el-tooltip content="修改" placement="top" effect="light" :enterable="false">
                    <el-button size="mini" type="warning" icon="edit"
                               @click="toEdit(scope.row)"></el-button>
                </el-tooltip>
                <el-tooltip content="删除" placement="top" effect="light" :enterable="false">
                    <el-button size="mini" type="danger" icon="delete"
                               @click="del(scope.row)"></el-button>
                </el-tooltip>
            </template>
        </el-table-column>
    </el-table>
    <edit @save-success="search" ref="edit"></edit>
</div>